package cn.edu.sgu.www.mhxysy.service.system.impl;

import cn.edu.sgu.www.mhxysy.entity.system.TableField;
import cn.edu.sgu.www.mhxysy.feign.clients.pms.PmsFeignService;
import cn.edu.sgu.www.mhxysy.restful.JsonResult;
import cn.edu.sgu.www.mhxysy.service.system.TableFieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 沐雨橙风ιε
 * @version 1.0
 */
@Service
public class TableFieldServiceImpl implements TableFieldService {

    private final PmsFeignService feignService;

    @Autowired
    public TableFieldServiceImpl(PmsFeignService feignService) {
        this.feignService = feignService;
    }

    @Override
    public List<TableField> selectFields(String tableName) {
        JsonResult<List<TableField>> jsonResult = feignService.selectFields(tableName);

        if (jsonResult.isSuccess()) {
            return jsonResult.getData();
        }

        return null;
    }

}